#include <fstream>
using namespace std;
#include "dataspace.h"

int main(int argc, char** argv)
{
  try {
  DataSpace ds;
  ds.axes.add_axis<int>("Z");
  ds.axes.add_axis<int>("X");
  ds.axes.add_axis<int>("Y");
  vector<data_index_t> max_shape(3, 100);
  string dataspace_fn = "DS.DS";
  DynType* dt = DynTypeManager::get()->get_dyntype("char[10]");
  ds.create_datafield(dataspace_fn, dt, max_shape);
  
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      for (int k = 0; k < 10; k++) {
	AxesCoor c(&ds.axes);
	c.set_at<int>(0, i);
	c.set_at<int>(1, j);
	c.set_at<int>(2, k);
	//ds.set_value<double>(c, i + j + k, true);
	ostringstream v; v << "S" << i+j+k;
	ds.set_value<CharN<10> >(c, CharN<10>(v.str().c_str()), true);
	//print_coor(cout, ds.axes.get_axis_indexes_coor(c)); cout << endl;
      }
    }
  }
  
  cerr << "hi" << endl;
  ds.save();
  } catch (Error& e) {
    cout << "Error caught " << e.msg() << endl;
  }
}
